// uAutoPagerize 的配置文件。Ver 0.2.2 以上专用。
// UPDATE: 2013-10-13 20:00

var MY_SITEINFO = [
    // ================ 需要特别处理的网站：诸如修复下一页图片显示等 ========================
    {name: "Google搜索（fix image and video）",
        url: '^https?\\:\\/\\/(www|encrypted)\\.google\\..{2,9}\\/(webhp|search|#|$|\\?)',
        nextLink: 'id("pnnext")|id("navbar navcnt nav")//td[span]/following-sibling::td[1]/a|id("nn")/parent::a',
        pageElement: "//div[@id='ires']",
        documentFilter: function(doc){
            // 修正 imgsrc
            Array.slice(doc.querySelectorAll("img[imgsrc]")).forEach(function(img){
                img.setAttribute("src", img.getAttribute('imgsrc'));
                img.removeAttribute('imgsrc');
            });

           	// 修正 script 内
	        var x = doc.evaluate('//script/text()[contains(self::text(), "data:image/")]', doc, null, 9, null).singleNodeValue;
	        if (!x) return;

	        var datas = x.nodeValue.match(/'[^']+','[^']+(?:\\x3d)*/g);
	        datas.forEach(function(text) {
                var arr = text.split("','"),
                    id = arr[0].slice(1),
                    data = arr[1];
	            var m = doc.getElementById(id);
	            if (m) m.setAttribute("src", data.replace(/\\x3d/g, "="));
	        });
        }
    },


    {name: 'VeryCD搜索页面',
        url: /http:\/\/www\.verycd\.com\/search\/folders.+/i,
        siteExample: 'http://www.verycd.com/search/folders/opera',
        nextLink: '//ul[@class="page"]//a[contains(text(),"下一页")][@href]',
        pageElement: '//ul[@id="resultsContainer"]',
        fragmentFilter: function(df) {
            Array.slice(df.querySelectorAll('.cover img')).forEach(function(img) {
                img.src = img.getAttribute('_src');
                img.removeAttribute('_src');
            });
        }
    },
    {name: 'youtube 搜索列表',
        url: "^https?://www\\.youtube\\.com/results",
        nextLink: "//div[contains(concat(\" \", @class, \" \"), \" yt-uix-pager \")]//a[last()][@href]",
        pageElement: "id(\"search-results result-list context-data-container\")",
        fragmentFilter: function(df) {
            Array.slice(df.querySelectorAll('img[data-thumb]')).forEach(function(img) {
                img.src = img.getAttribute('data-thumb');
                img.removeAttribute('data-thumb');
            });
        }
    },
    {name:'百度贴吧列表',
        url:/^http:\/\/tieba\.baidu\.(cn|com)\/f/i,
        nextLink:'//div[@class="pager clearfix"]/descendant::a[@class="next"]',
        pageElement:'//ul[@id="thread_list"]',
        filter: function(pages){
            // 修复图片点击放大、播放音乐等
            var doc = this.document,
                frs = this.wrappedJSObject.frs;

            // 修改 frs.ThreadList.render();
            var renderFunc = frs.ThreadList.render.toString()
                .replace('$("ul")', 'var list=document.querySelectorAll("#thread_list"),last=list[list.length - 1];$(last)');

            var script = doc.createElement("script");
            script.textContent = 'var render=' + renderFunc + ';render.apply(frs.ThreadList);';
            doc.body.appendChild(script);
            doc.body.removeChild(script);
        }
    },
    // 修复下一页图片和回复
    {name: '百度贴吧帖子',
        url: /^http:\/\/tieba\.baidu\.com\/p/i,
        nextLink: 'auto;',
        pageElement: 'css;.l_post',
        filter: function(pages){
            var pb = this.wrappedJSObject.pb;
            pb.ForumListV3.initial();
        }
    },
    {name: '天涯论坛帖子(修复只看楼主)',
        url: '^http://bbs\\.tianya\\.cn/.+\\.shtml',
        nextLink: '//div[@class="atl-pages"]/descendant::a[text()="下页"][@href]',
        pageElement: '//div[@class="atl-main"]',
        useiframe: true,
        filter: function(pages){
            var see_only_uname = this.wrappedJSObject.see_only_uname;
            var setOnlyUser = this.wrappedJSObject.setOnlyUser;
            if(see_only_uname){
                setOnlyUser(see_only_uname);
            }
        }
    },
    // 修复图片，推荐、收藏、评论点击
    {name: '抽屉新热榜',
        url: '^http://dig\\.chouti\\.com/',
        nextLink: '//a[@class="ct_page_edge" and (text()="下一页")]',
        pageElement: '//div[@id="content-list"]',
        fragmentFilter: function(df) {
            Array.slice(df.querySelectorAll('img[original]')).forEach(function(img) {
                img.src = img.getAttribute('original');
                img.removeAttribute('original');
            });
        },
        filter: function(pages){
            var chouti = this.wrappedJSObject.chouti;
            var NS_links_comment_top = this.wrappedJSObject.NS_links_comment_top;
            chouti.vote();
            chouti.addCollect();
            chouti.shareweibo();
            chouti.playVido();
            NS_links_comment_top.init();
        }
    },

    // ======================================= news ================================================
    {name:'新浪新闻',
        url: /sina\.com\.cn\/news\//i,
        nextLink:'auto;',
        pageElement:'//div[@id="artibody"]'
    },

    // ======================================= baidu ================================================
    {name: '百度吧内搜索',
        url: /^http:\/\/tieba\.baidu\.com\/f\/search/i,
        siteExample: 'http://tieba.baidu.com/f/search/',
        nextLink: 'auto;',
        pageElement: 'css;.s_post'
    },
    {name: '百度空间',
        url: '^http://hi\\.baidu\\.com',
        nextLink: {
            startAfter: '?page=',
            mFails: [/^http:\/\/hi\.baidu\.com\/.+/i, '?page=1'],
            inc: 1,
            isLast: function(doc, win, lhref) {
                var script = doc.querySelector("#pagerBar > script");
                var m = script && script.textContent.match(/pageSize.*'(\d+)'[\s\S]*curPage.*'(\d+)'/);
                if (m && (m.length === 3)) {
                    if (parseInt(m[2]) >= parseInt(m[1]))
                        return true;
                }
            }
        },
        pageElement: '//div[@class="mod-realcontent mod-cs-contentblock"]',
        exampleUrl: 'http://hi.baidu.com/gelida',
    },
    {name: '百度新闻搜索',
        url: '^http://news\\.baidu\\.(?:[^.]{2,3}\\.)?[^./]{2,3}/ns',
        nextLink: 'id("main_content")/descendant::a[text()="下一页>"]',
        pageElement: 'id("main_content")/div[@id="r"]',
    },
    // 需要修复下一页按钮等
    // {name: '百度音乐（tag）',
    //     url: '^http://music\\.baidu\\.com/tag/',
    //     nextLink: '//div[@class="music-main"]/descendant::a[text()="下一页>"]',
    //     pageElement: '//div[@class="tag-main"]/div[@class="search-song-list song-list song-list-hook"]',
    // },

    // =============================================== software ================================================
    {name: '小众软件',
        url: 'http://www\\.appinn\\.com/',
        nextLink: '//a[@class="nextpostslink"]',
        pageElement: '//div[@id="spost"]',
    },
    {name: 'PlayNext - 低调的异次元',
        url: '^http://www\\.playnext\\.cn/',
        nextLink: '//div[@class="pagenavi"]/a[contains(text(), "下一页")]',
        pageElement: '//div[@id="container"]/div[@class="content"]/div[@class="post-list"]',
    },
    {name: '精品绿色便携软件',
        url: '^http://www\\.portablesoft\\.org/',
        nextLink: '//div[@class="pagination"]/a[text()="下页 ›"]',
        pageElement: 'id("main")/div[@class="post-entry"]'
    },
    {name: '独木成林',
        url: '^http://www\\.guofs\\.com/',
        nextLink: '//a[@class="nextpostslink"]',
        pageElement: 'id("content")',
        exampleUrl: 'http://www.guofs.com/',
    },
    {name: '软件淘',
        url: '^http://www\\.65052424\\.com/',
        nextLink: '//a[@class="next"]',
        pageElement: '//div[@id="content"]',
        exampleUrl: 'http://www.65052424.com/page/7',
    },

    // =============================================== 杂项 ================================================
    {name: '暴走漫画',
        url: '^http://baozoumanhua\\.com/',
        nextLink: '//div[@class="pagebar"]/a[text()="下一页"] | //a[@class="next" and (text()="下一页")]',
        pageElement: '//div[@class="main cf"]/div[@class="content-block cf"]/div[1]',
    },
    {name: '译言网',
        url: '^http://article\\.yeeyan\\.org/.*$',
        nextLink: '//ul[contains(concat(" ",normalize-space(@class)," "), " y_page") ]/li/a[text()="下一页"]',
        pageElement: '//div[contains(concat(" ",normalize-space(@class)," "), "content_box")]',
    },
    {siteName: '大众点评网',
        url: '^http://www\\.dianping\\.com/.*',
        nextLink: '//a[@class="NextPage" and @title="下一页" and (text()="下一页")]',
        pageElement: '//div[@id="searchList"]',
    },
    {name: '豆瓣-书影音评论',
        url: '^http://.*\\.douban\\.com/subject.*',
        nextLink: '//div[@class="paginator"]/span[@class="next"]/a[contains(text(),"后页>")]',
        pageElement: '//ul[contains(@class,"topic-reply")] | //div[@id="comments" or @class="post-comments"]'
    },
    {name: '豆瓣全站',
        url: '^http://.*\\.douban\\.com/.*',
        nextLink: '//div[@class="paginator"]/span[@class="next"]/a[contains(text(),"后页>")]',
        pageElement: 'id("miniblog") | //*[@class="photolst clearfix" or @class="photolst clearbox" or @class="event-photo-list" or @class="poster-col4 clearfix"] | \
            //div[@id="comment-section"] | //table[@class="olt" or @class="list-b"]/tbody | //div[contains(@class,"clearfix")]/div[@class="article"]'
    },
    {siteName: '主题站 | 果壳网 ',
        url: '^http://www\\.guokr\\.com/(?:site|group|ask|event)/',
        nextLink: '//ul[@class="gpages"]/li/a[contains(.,"下一页")]',
        pageElement: '//div[@class="article-list"] | //ul[@class="titles"] | //ul[@class="ask-list"] | //ul[@class="event_list gclear"]',
    },
    {name: '天涯论坛_帖子列表',
        url: '^http://bbs\\.tianya\\.cn/list',
        nextLink: '//a[text()="下一页"]',
        pageElement: '//div[@class="mt5"]',
    },
    {name: '优酷全部视频',
        url: '^http://(?:www|u)\\.youku\\.com/',
        nextLink: '//a[em/@class="ico_next"] | //a[@title="下一页"]',
        pageElement: '//div[@id="list" or @id="listofficial"] | id("imgType")'
    },
    {name: '优酷电视剧—检索',
        url: '^http://tv\\.youku\\.com/search',
        nextLink: '//a[span[@class="ico__pagenext"]]',
        pageElement: '//div[@class="mainCol"]/descendant::div[@class="items"]',
    },
    {name: '水木社区',
        url: '^http://www\\.newsmth\\.net/nForum.*',
        nextLink: '//a[@title="下一页"]',
        pageElement: '//div[@class="b-content"] | //div[@class="b-content corner"]',
        exampleUrl: 'http://www.newsmth.net/nForum/#!board/TouHou'
    },
	{
	    name: "卡饭论坛",
	    url: "^http://bbs\\.kafan\\.cn/",
	    nextLink: "//a[@class='nxt' and (text()='下一页')]",
	    pageElement: "//form[@method='post'][@name] | //div[@id='postlist'] | //div[@id='threadlist']/div[@class='bm_c']",
	},
    {name: '卡饭论坛_纵横搜索',
        url: '^http://search\\.kafan\\.cn/f/search\\?q=',
        nextLink: '//p[@id="pager" and @class="pager"]/a[(text()="下一页>")]',
        pageElement: '//div[@id="main"]/div/div[@class="result"]',
    },
    {name: 'Mozilla Firefox中文社区',
        url: '^http://www\\.firefox\\.net\\.cn/forum/.*',
        nextLink: '//a[text()="下一页"]',
        pageElement: 'id("pagecontent")/table[@class="tablebg"]'
    },
    {name: 'mozest社区（去iframe）',
        url: /^https?:\/\/g\.mozest\.com/i,
        nextLink: '//div[@class="pages"]//a[@class="next"]',
        pageElement: '//div[@id="threadlist"] | //div[@id="postlist"]',
    },
    {name: 'OperaChina',
        url: /http:\/\/(?:bbs\.operachina\.com|oc\.ls\.tl)/i,
        nextLink: 'auto;',
        pageElement: '//table | //article[@id][contains(@class, "post")]'
    },
    {name: '人人影视',
        url: '^http://www\\.yyets\\.com/resourcelist',
        nextLink: "//div[starts-with(@class, 'pages')]/descendant::a[text()='下一页']",
    	pageElement: "//div[@class='box_1 topicList'] | //div[@class='box_4 res_listview']",
        exampleUrl: 'http://www.yyets.com/resourcelist',
    },
    {name: '霏凡论坛',
        url: 'http://bbs\\.crsky\\.com/read\\.php',
        nextLink: '//div[@class="pages"]/descendant::a[text()=">"]',
        pageElement: '//div[@class="t5 t2"]',
        exampleUrl: 'http://bbs.crsky.com/read.php?tid=2067903&fpage=0&toread=&page=2',
    },
    {name: 'pconline',
        url: '^http://itbbs\\.pconline\\.com\\.cn/diy/',
        nextLink: '//a[@class="next"]',
        pageElement: '//table[@class="posts"] | id("post_list")',
        exampleUrl: 'http://itbbs.pconline.com.cn/diy/f250.html',
    },
    {name: '小米手机官方论坛',
        url: '^http://bbs\\.xiaomi\\.cn/',
        nextLink: '//a[@class="nxt" and (text()="下一页")]',
        pageElement: 'id("postlist")|id("threadlist")',
        fragmentFilter: function(fragment, doc, pages){
            var firstDiv = fragment.querySelector("div[id^='post_']");
            firstDiv.parentNode.removeChild(firstDiv);
        }
    },
    {name: '傲游浏览器-插件中心',
        url: "^http://extension\\.maxthon\\.cn/",
        nextLink: '//div[@class="pages page-right"]/a[text()=">"]',
        pageElement: '//ul[@id="delegate-all"]'
    },
    {name: "下厨房",
	    url: "^http://www\\.xiachufang\\.com",
	    nextLink: "//div[@class='pager']/a[text()='下一页']",
	    pageElement: "//div[@class='recipe-list'] | //div[@class='g-recipe-list-img'] | //div[@class='user-recipe-list'] | //div[@class='menu-list']"
	},
	{name: "nga.178",
	    url: "^http://nga\\.178\\.com/",
	    nextLink: "//a[@title='下一页']",
	    pageElement: "id('m_posts_c') | //table[@id='topicrows']"
	},
    {name: '博客园',
        url: '^http://www\\.cnblogs\\.com/.*$',
        nextLink: '//a[(text()="Next >")]',
        pageElement: '//div[@id="post_list"]',
        exampleUrl: 'http://www.cnblogs.com/cate/javascript/',
    },
    {name: '开源中国',
        url: '^http://\\w+\\.oschina\\.net/',
        nextLink: '//li[@class="page next"]/a',
        pageElement: '//div[@class="code_list"]/ul | //div[@class="ProjectList"]/ul[@class="List"] | id("OSC_Content")/div[@class="SpaceList BlogList"]/ul | \
            id("OSC_Content")/div[@class="QuestionList"]/ul/li[@class="question"]',
    },
    {name: 'BookLink.Me:最有爱的小说搜索引擎',
        url: '^http://booklink\\.me/.*',
        nextLink: '//a[text()="下一页"] | //a[font[text()="下一页"]]',
        pageElement: '//table[@width="100%"][@cellspacing="0"][@cellpadding="2"]',
    },
    {name: '顶点小说',
        url: '^http://www\\.23us\\.com/html/.+\\.html',
        siteExample: 'http://www.23us.com/html/26/26627/16952316.html',
        nextLink: ' //dd[@id="footlink"]/descendant::a[text()="下一页"]',
        pageElement: 'id("amain")/dl/dd/h1 | id("contents")'
    },
    {name: 'bookcool-小说合集',
        url: '^http://www\\.bookcool\\.com/.*\\.htm',
        nextLink: '//div[@id="object1"]/descendant::a[last()][@href]',
        pageElement: '//div[@align="center"]/table[@width !="100%"]',
    },
    {name: 'iiikl论坛',
        url: '^http://bbs\\.iiikl\\.net/forum\\.php\\?forum_id=.*',
        nextLink: '//a[@class="next"]',
        pageElement: '//tr[@class="topic_list_row"]',
        exampleUrl: 'http://bbs.iiikl.net/forum.php?forum_id=82&class_id=0&page=2'
    },
    {name: '糗事百科',
        url: '^http://www\\.qiushibaike\\.com/',
        nextLink: '//a[@class="next" and (text()="下一页")]',
        pageElement: '//div[@class="main"]/div[@class="content-block"]/div[@class="col1"]',
        exampleUrl: 'http://www.qiushibaike.com/8hr/page/2/?s=4559487',
    },
    {name: '17173.com中国游戏第一门户站',
        url: '^http://news\\.17173\\.com/content/.*\\.shtml',
        nextLink: '//a[@class="page-next"]',
        pageElement: '//div[@id="matterc"]',
    },
    {name: '美姿女性网 - 国内专业全面的女性网站',
        url: '^http://[a-z]+\\.meizw\\.com/.*\\.html',
        nextLink: '//div[@id="content_pages"]/li/a[(text()="下一页")]',
        pageElement: '//div[div[2]/@id="content_pages"]',
        exampleUrl: 'http://fashion.meizw.com/street/20130815/328344.html',
    },
    {name: '我们一起成长 | 幸福进化俱乐部共同成长博客圈',
        url: '^http://upwith\\.me/',
        nextLink: '//nav[@class="navigation"]/a[(text()=">")]',
        pageElement: '//div[@id="main"]',
    },
    {name: "bt无忧无虑",
        url: "^http://bbs\\.bt5156\\.com/thread\\.php",
        nextLink: "//div[@class='pages']/b/following-sibling::a[1]",
        pageElement: "//table[@id='ajaxtable']/tbody[2]/tr",
        exampleUrl: "http://bbs.bt5156.com/thread.php?fid-8.html",
    },
    {name: '极限社区',
        url: '^http://bbs\\.themex\\.net/',
        nextLink: '//a[@rel="next"]',
        pageElement: 'id("threadslist posts")',
    },
    {name: "中国结论坛帖子",
        url: "^http://bbs\\.zhongguojie\\.org/forum\\.php",
        nextLink: "//a[@class='nxt' and (text()='下一页')]",
        pageElement: "//div[@class='mn']/div[@class='bm vw pl']"
    },
    {name: 'Sublime text - Packages',
        url: '^https://sublime\\.wbond\\.net/browse',
        nextLink: '//nav[@class="pagination"]/a[@class="selected"]/following::a[1]',
        pageElement: '//div[@id="content"]/div[@class="results"]/ul[@class="packages results"]',
    },
    {name: "ppxclub 模拟器|推理剧|琵琶行|纸模|字幕组|MAME|PS2|PS3|NDS|PSP",
        url: '^http://f\\.ppxclub\\.com/.*',
        nextLink: '//a[@class="nxt"]',
        pageElement: '//div[@class="pl bm"] | id("threadlist")/div',
        exampleUrl: 'http://f.ppxclub.com/147006-1-2'
    },
    {name: 'getuploader',
        url: "^http://[^.]+\\.getuploader\\.com/",
        nextLink: "//li[contains(concat(\" \", @class, \" \"), \" current \")]/following-sibling::li[contains(concat(\" \", @class, \" \"), \" page \")]/a",
        pageElement: "id(\"primary\")/table/tbody/tr|id(\"thumbnail\")"
    },
    {name: '九尾报童_九尾网',
        url: 'http://www\\.joowii\\.com/arc/jwbt/.*\.html',
        siteExample: 'http://www.joowii.com/arc/jwbt/hqsb/2013/0711/149370.html',
        nextLink: 'auto;',
        pageElement: '//body/*',
    },

    // ================================= 国外网站 ========================================
    {name: 'twitter mobile',
        url: '^https://mobile\\.twitter\\.com/[^/]+/status(?:es)?/\\d',
        nextLink: 'id("tweets-list")/div[@class="list-tweet"][1]/div[@class="list-tweet-status permalink"]/a[@class="status_link"][2]',
        pageElement: 'id("tweets-list")',
    },
	{name: 'User Scripts/Styles修复',
        url: /^https?:\/\/user(scripts|styles)\.org\/(scripts|tags|styles\/browse|home\/favorites)/i,
        nextLink: 'auto;',
        pageElement: '//table[@class="wide forums"] | //article[starts-with(@class,"style-brief")]',
    },
	{name: "Stack Overflow, Super User, Server Fault, Stack Apps",
        url: "^http://(?:meta\\.)?(?:s(?:erverfault|tackoverflow|uperuser|tackapps)|\\w+\\.stackexchange|askubuntu)\\.com/",
        nextLink: '//a[@rel="next"]',
        pageElement: "id(\"mainbar questions\")//div[contains(concat(\" \",@class,\" \"),\" question-summary \")]|id(\"answers\")/div[@class=\"pager-answers\"][1]/following-sibling::*[./following-sibling::div[@class=\"pager-answers\"]]",
    },
    {
        "url": "^http://www\\.flickr\\.com/photos/[^/]+/favorites(?:[/?#]|$)",
        "nextLink": "id(\"paginator-module\")/descendant::a[contains(concat(\" \", @class, \" \"), \" Next \")]",
        "pageElement": "id(\"faves\")",
        "insertBefore": "//div[@class=\"Pages\"]"
    },
    {
        "url": "^https?://forums\\.dropbox\\.com/topic\\.php",
        "nextLink": "//div[@class=\"nav\"][last()]/a[@class=\"next page-numbers\"]",
        "pageElement": "id(\"thread\")/li"
    },
    {
        "url": "^https?://forums\\.dropbox\\.com/forum\\.php",
        "nextLink": "//div[@class=\"nav\"][last()]/a[@class=\"next page-numbers\"]",
        "pageElement": "id(\"latest\")/tbody/tr"
    },

    // ======================================= google ================================================
    {
        "url": "^https?://www\\.google\\.(?:[^.]{2,3}\\.)?[^./]{2,3}/bookmarks/",
        "nextLink": "//div[contains(concat(\" \", @class, \" \"), \" kd-buttonbar \")]//tr/td[last()-1 or last]/a[img[contains(@src,\"right.png\")]]",
        "pageElement": "id(\"search\")"
    },
    {
        "url": "^http://[^.]+\\.google\\.(?:[^.]{2,3}\\.)?[^./]{2,3}/codesearch",
        "nextLink": "(id(\"navbar\")//td[@class=\"b\"]/a)[last()]",
        "pageElement": "//*[self::div[@class=\"h\"] or self::pre[@class=\"j\"] or self::div[@class=\"f\"]]",
        "insertBefore": "id(\"navbar\")"
    },
    {
        "url": "^https?://groups\\.google(?:\\.[^./]{2,3}){1,2}/groups/search",
        "nextLink": "id(\"navbar\")//td[last()][@class=\"b\"]/a",
        "pageElement": "id(\"res\")/*[self::div or self::br]"
    },
    {
        "url": "^http://scholar\\.google\\.(?:[^.]{2,3}\\.)?[^./]{2,3}/scholar",
        "nextLink": "//div[contains(concat(\" \", @class, \" \"), \" n \")]/table/tbody/tr/td[last()]/a|id(\"gs_n\")//table/tbody/tr/td[span and b]/following-sibling::td/a",
        "pageElement": "//form[@name=\"gs\"]/following-sibling::node()[ following::div[contains(concat(\" \", @class, \" \"), \" n \")] ]|id(\"gs_ccl\")/div[@class=\"gs_r\"]"
    },
    {
        "url": "^http://(?:[^.]+\\.)?google\\.(?:[^.]{2,3}\\.)?[^./]{2,3}/news",
        "nextLink": "id(\"end-next\")/..",
        "pageElement": "id(\"search-stories story-articles\")"
    },
    {
        "url": "^https?://www\\.google\\.(?:[^.]{2,3}\\.)?[^./]{2,3}/history/",
        "nextLink": "//td[@class=\"bl\"][last()-1]/a|//div[@class=\"nn\"]/parent::a",
        "pageElement": "//table[@class=\"res\"]"
    },
    {
        "url": "^http://www\\.google\\.[^./]{2,3}(?:\\.[^./]{2,3})?/logos/",
        "nextLink": "//div[@class=\"base-nav\"]//a[contains(., \"«\")]",
        "pageElement": "id(\"doodles\")|//div[contains(concat(\" \", @class, \" \"), \" title \")]"
    },
    {
        "url": "^http://books\\.google\\.(?:[^.]{2,3}\\.)?[^./]{2,3}/books",
        "nextLink": "id(\"navbar\")//span[@class=\"navlink\"]/parent::a",
        "pageElement": "id(\"main_content\")/*"
    },
    {
        "url": "^https?://appengine\\.google\\.com/datastore/explorer\\?.",
        "nextLink": "id(\"ae-datastore-explorer\")//a[@class=\"ae-paginate-next\"]",
        "pageElement": "id(\"ae-datastore-explorer-entities\")"
    },
    {
        "url": "^https?://(?:[^/]+\\.)?google(?:\\.\\w{2,3}){1,2}/movies",
        "nextLink": "id(\"pnnext\")|id(\"navbar navcnt nav\")//td[span]/following-sibling::td[1]/a|id(\"nn\")/parent::a",
        "pageElement": "id(\"movie_results\")/*"
    },
    {
        "url": "^https://chrome\\.google\\.com/webstore/(?:list|search)",
        "nextLink": "//table[@class=\"paginator\"]//td[last()]/a",
        "pageElement": "//div[@class=\"mod-fullpage\"]/div[@class=\"mod-body\"]"
    },
    {
        "url": "^http://www\\.google\\.com/intl/ja/googlebooks/chrome/",
        "nextLink": "id(\"info\")/p[contains(concat(\" \",@class,\" \"),\"nav\")]/a[img[@src=\"images/arrowright.gif\"]]",
        "pageElement": "id(\"page\")/div[a[img] or img]"
    },
    {
        "url": "^http://desktop\\.google\\.(?:[^.]{2,3}\\.)?[^./]{2,3}/",
        "nextLink": "id(\"content\")/table[@class=\"header\"]//a[contains(., \"»\")]",
        "pageElement": "id(\"content\")/*[(self::table and @class=\"gadget\") or (self::br and @style=\"clear: both;\")]"
    },
    {
        "url": "^http://sketchup\\.google\\.com/3dwarehouse/search\\?",
        "nextLink": "//div[@class=\"pager_next\"]/parent::a",
        "pageElement": "//div[@class=\"searchresult\"]/ancestor::tr[1]"
    },
    {
        "url": "^https?://code\\.google\\.com/[pr]/(?:[^/]+/){2}list",
        "nextLink": "id(\"colcontrol\")//div[contains(concat(\" \", @class, \" \"), \" pagination \")]/a[contains(., \"›\")]",
        "pageElement": "id(\"resultstable\")//tr"
    },
    {
        "url": "^https?://code\\.google\\.com/hosting/search\\?",
        "nextLink": "id(\"serp\")/following::a[contains(., \"Next\")][1]",
        "pageElement": "id(\"serp\")/*"
    },
    {
        "url": "^https://www\\.google\\.com/a/cpanel/[^/]+/",
        "nextLink": "//tr//ul[@class=\"inlinelist\"]//a[contains(text(),\"›\")]",
        "pageElement": "id(\"list\")"
    },
    {
        "url": "^http://www\\.google\\.com/support/forum/",
        "nextLink": "//div[@class=\"wppkrootCSS\"]/a[contains(text(), \">\")]",
        "pageElement": "//table[@class=\"lctCSS\"]"
    },
    {
        "url": "^http://www\\.google\\.com/products\\?",
        "nextLink": "id(\"nn\")/parent::a",
        "pageElement": "id(\"results\")|id(\"results\")/following-sibling::p[@class=\"clear\"]"
    },
    {
        "url": "^http://www\\.google\\.com/reviews/t",
        "nextLink": "//a[contains(text(), \"Next\")]",
        "pageElement": "id(\"allresults\")/table",
        "insertBefore": "//div[contains(concat(\" \", normalize-space(@class), \" \"), \" t_ftr \")]"
    },
    {
        "url": "^http://www\\.google\\.com/cse\\?cx=",
        "nextLink": "//div[@class='gsc-cursor-page gsc-cursor-current-page']/following-sibling::node()[1]",
        "pageElement": "//div[@class='gsc-webResult gsc-result']",
        "insertBefore": "//div[@class='gsc-cursor-box gs-bidi-start-align']"
    },
    {
        "url": "^http://www\\.google(?:\\.[^./]{2,3}){1,2}/m\\?.",
        "nextLink": "//*[starts-with(text(), \"Next page\") or starts-with(text(), \"次のページ\")]",
        "pageElement": "id(\"universal\")/div[not(@*)]",
        "insertBefore": "id(\"universal\")/*[@class][last()]"
    },
    {
        "url": "^http://followfinder\\.googlelabs\\.com/search",
        "nextLink": "//td[@class=\"more\"]//a[last()]",
        "pageElement": "//table//tr[//div]"
    },
    {
        "url": "^http://www\\.googlelabs\\.com/",
        "nextLink": "id(\"nav\")//td[@class=\"cur\"]/following-sibling::td[1]/a",
        "pageElement": "id(\"nav\")/preceding-sibling::ul"
    },

    // ======================================= github ================================================
    {
        "url": "^https?://github\\.com/(?:$|dashboard|(?:timeline|[^/]+/[^/]+/(?:comments|network/feed)))",
        "nextLink": "//a[@hotkey=\"l\"]|//div[contains(concat(\" \",@class,\" \"),\" pagination \")]/a",
        "pageElement": "//div[@class=\"news\"]/div[contains(@class, \"alert\")]"
    },
    {
        "url": "^https?://github\\.com/search",
        "nextLink": "//div[@class=\"pagination\"]/a[@rel=\"next\"]",
        "pageElement": "id(\"code_search_results issue_search_results\")|//div[@class=\"sort-bar\"]/following-sibling::*[following-sibling::span[@class=\"search-foot-note\"]]",
        "insertBefore": "//div[@class=\"pagination\"]"
    },
    {
        "url": "^https?://gist\\.github\\.com/",
        "nextLink": "//div[contains(concat(\" \", @class, \" \"), \" pagination \")]/a[contains(text(),\"Older\")]",
        "pageElement": "//div[contains(concat(\" \", @class, \" \"), \" gist-item \")]"
    },
        // 有点小问题，需要刷新下才有用
    {
        "url": "^https?://github\\.com/(?:changelog|[^/]+/[^/]+/commits)",
        "nextLink": "//a[contains(text(), \"Older\")]",
        "pageElement": "//*[starts-with(@class,\"commit-group\")]"
    },
    {
        "url": "^https?://github\\.com/[^/]+/[^/]+/watchers",
        "nextLink": "//div[@class=\"pagination\"]/span[@class=\"current\"]/following-sibling::a",
        "pageElement": "id(\"watchers\")"
    },
    {
        "url": "^https?://github\\.com/[^/]+/following",
        "nextLink": "//a[hotkey='l']",
        "pageElement": "id(\"watchers\")"
    },
    {
        "url": "^http://learn\\.github\\.com/p/",
        "nextLink": "//a[contains(text(), \"next\")]",
        "pageElement": "//div[@class=\"container\"]/div[@id=\"welcome\" or @class=\"content\"]"
    },
    {
        "url": "^http://github\\.com/blog",
        "nextLink": "//div[contains(concat(\" \",@class,\" \"),\" pagination \")]/a[contains(text(),\"Next\")]",
        "pageElement": "id(\"posts\")/div[contains(concat(\" \",@class,\" \"),\" list \")]/ul/li"
    },

    {name: 'blogspot',
        url: '^http://[^./]+\\.(blogspot|playpcesor)(?:\\.[^./]{2,3}){1,2}/(?!\\d{4}/)',
        nextLink: '//a[contains(concat(" ", @class, " "), " blog-pager-older-link ")]',
        pageElement: '//div[contains(concat(" ", @class, " "), " hfeed ") or contains(concat(" ", @class, " "), " blog-posts ")] | id("Blog1")/div[contains(concat(" ", @class, " "), " entry ")]',
        exampleUrl: 'http://program-think.blogspot.com/  http://www.playpcesor.com/',
    },
    {
        "url": "^https?://userscripts\\.org/(?:(?:forum|tag|user)s/|(?:script|topic)s)",
        "nextLink": "id(\"content main\")/div[@class=\"pagination\"]/a[contains(@rel,'next')]",
        "pageElement": "id(\"content main\")/table |id(\"review-list\")"
    },
    {
        "url": "^http://www\\.imdb\\.com/name/[^/]+/(?:mediaindex|videogallery)",
        "nextLink": "id(\"right\")/a[last()]|//span[@class=\"pagination\"]/a[last()]",
        "pageElement": "id(\"main\")/*"
    },
    {
        "url": "^http://www\\.vim\\.org/scripts/script_search_results\\.php",
        "nextLink": "//a[text()=\"next\"]",
        "pageElement": "//h1/following-sibling::table",
        "insertBefore": "//h1/following-sibling::table/following-sibling::node()"
    },
    {
        "url": "^http://(www\\.bilibili\\.tv/search|space\\.bilibili\\.tv/)",
        "nextLink": "//div[@class=\"pagelistbox\"]/a[@class=\"nextPage\"]|//ul[@class=\"page\"]/li[@class=\"current\"]/following-sibling::li[1]/a",
        "pageElement": "//div[@class=\"searchlist\"]/ul[@class=\"search_result\"]/li|//div[@class=\"main_list\"]/ul/li"
    },
    {
        "url": "^http://portableapps\\.com/(?:forums|node)/",
        "nextLink": "//li[@class=\"pager-next\"]/a",
        "pageElement": "id(\"forum\")/table|id(\"comments\")/*[not(@class=\"item-list\")]"
    },

    // super_preloader 中使用 iframe 加载的已经失效的站点修正
    {name: '阿巴达小说网',
        url: /^http:\/\/www\.abada\.(cn|com)\/Book\/.+\.html/i,
        siteExample: 'http://www.abada.com/Book/5689/698012.html',
        nextLink: '//div[@class="bookopt"]/descendant::a[text()="翻下页"]',
        useiframe: true,
        pageElement: '//div[@class="bookcontent"]'
    },
	{name: '178漫画, 动漫之家',
        url: /^http:\/\/(?:manhua\.178\.com|www\.dmzj\.com)\/.+\.shtml/i,
        siteExample: 'http://manhua.178.com/lansechumoshi/15794.shtml',
        nextLink: '//div[@class="pages2"]/descendant::a[text()="下一页"]',
        pageElement: '//div[@class="inner_img"]',
        useiframe: true,
    },
	{name: "动漫屋",
        url: '^http://www\\.dm5\\.com/m\\d+/',
        nextLink: 'id("s_next")/a',
        pageElement: 'id("showimage")',
        useiframe: true,
        exampleUrl: 'http://www.dm5.com/m118202/'
    },

    {name: '技术社區',
        url: '^http://(www\\.)?t66y\\.com/',
        nextLink: '//div[@class="pages"]/b/following-sibling::a[1]',
        pageElement: 'id("ajaxtable")',
        exampleUrl: 'http://t66y.com/thread0806.php?fid=15',
    },
    {name: 'Hachiya Makoto',
        url: '^http://g\\.e-hentai\\.org/s/.*$',
        nextLink: '//img[@src="http://ehgt.org/g/n.png"]/..',
        pageElement: '//body/div[@class="sni"]',
        exampleUrl: 'http://g.e-hentai.org/s/2221a78fe2/592744-3',
        useiframe: true
    },
    {
        siteName    : 'STAGE1论坛列表',
        url         : '^http://bbs\.saraba1st\.com/2b/thread.*',
        nextLink    : '//div[starts-with(@class,"pages")]/b[1]/following-sibling::a[1][not(@class)] | //div[starts-with(@class,"pages")]/ul[1]/li[b]/following-sibling::li/a[1][not(@class)]',
        pageElement : '//div[@class="t z"] | //div[@class="z"] | //div[@id="ajaxtable"]',
    },
    {
        siteName    : 'STAGE1 论坛帖子',
        url         : '^http://bbs\.saraba1st\.com/2b/read.*',
        nextLink    : '//div[starts-with(@class,"pages")]/b[1]/following-sibling::a[1][not(@class)] | //div[starts-with(@class,"pages")]/ul[1]/li[b]/following-sibling::li/a[1][not(@class)]',
        pageElement : '//div[@class="t5"] | //div[@class="read_t"] | //div[@id="pw_content"]',
    },

    {name: 'Discuz论坛列表（去iframe）',
        url: /^https?:\/\/(?:www\.[^\/]+\/|[^\/]+\/(?:bbs\/)?)(?:(?:forum)|(?:showforum)|(?:viewforum)|(?:forumdisplay))+/i,
        preLink: '//div[@class="pages" or @class="pg"]/descendant::a[@class="prev"][@href]',
        nextLink: '//div[@class="pages" or @class="pg"]/descendant::a[@class="next" or @class="nxt"][@href] | //div[@class="p_bar"]/a[@class="p_curpage"]/following-sibling::a[@class="p_num"]',
        pageElement: '//form[@method="post"][@name] | //div[@id="postlist"]',
    },
	{name: 'Discuz论坛帖子（去iframe）',
        url: /https?:\/\/(?:www\.[^\/]+\/|[^\/]+\/(?:bbs\/)?)(?:(?:thread)|(?:viewthread)|(?:showtopic)|(?:viewtopic))+/i,
        preLink: '//div[@class="pages" or @class="pg"]/descendant::a[@class="prev"][@href]',
        nextLink: '//div[@class="pages" or @class="pg"]/descendant::a[@class="next" or @class="nxt"][@href] | //div[@class="p_bar"]/descendant::a[text()="››"]',
        pageElement: '//div[@id="postlist"] | //form[@method="post"][@name]',
    },
    {name: 'discuz论坛通用搜索',
        url: '^http://[^/]+/f/discuz',
        nextLink: 'auto;',
        pageElement: 'id("result-items")',
    },
    {name: 'View forum - 通用',
        url: '^https?://.+?/viewforum\\.php\\?',
        nextLink: '//span[@class="gensmall"]/b/b/following-sibling::a[1] | (//table/tbody/tr/td[@class="nav"])[last()]/b[last()]/following-sibling::a[1]  | //div[@class="pagination"]/span/strong/following-sibling::a[1] | //a[text()="Next"]',
        pageElement: '//ul[contains(concat(" ",@class," ")," topics ")]|//form[table/@class="forumline"]',
    },
    {name: 'wiki 通用',
        url: '.\\?(?:.+&)?search=',
        nextLink: '//a[@class="mw-nextlink"]',
        pageElement: '//ul[@class="mw-search-results"]',
    },
];